package bio.three;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class HandlerSocketPoll {
    //处理请求的线程池
    private ThreadPoolExecutor threadPoolExecutor;

    public HandlerSocketPoll(int maxThreadNum, int maxTaskNum) {
        threadPoolExecutor =
                new ThreadPoolExecutor(3, maxTaskNum, 120, TimeUnit.MINUTES, new ArrayBlockingQueue<Runnable>(maxTaskNum));
    }

    //提交任务
    public void commitTask(Runnable task) {
        threadPoolExecutor.execute(task);
    }
}
